﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/masAdmin.master" AutoEventWireup="true"
    CodeFile="ProductDetail.aspx.cs" Inherits="admin_ProductDetail" ValidateRequest="false" %>

<%--<%@ Register Assembly="CommonTagTime" namespace="Common.Editor" tagprefix="cc1" %>--%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="Server">
    <script src="../scripts/common.js"></script>
    <script src="../scripts/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript" language="javascript">

        tinyMCE.init({
            // General options
            mode: "exact",
            elements: "<%=txtDescription.ClientID %>",
            theme: "advanced",
            plugins: "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

            // Theme options

            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "hr,removeformat,visualaid,|,sub,sup",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left"
        });

    </script>
    <div class="content-box-header">
        <h3>
            Chi tiết sản phẩm
        </h3>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
            <table border="0" cellpadding="0" cellspacing="0" class="table100">
                <tr>
                    <td colspan="4">
                        <span class="commentRequireInputText">
                            <%=Resources.Resource.LBL_REQUIREMENT%>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td align="left" colspan="3">
                        <asp:ValidationSummary ID="vsumProduct" runat="server" ShowMessageBox="true" ShowSummary="false"
                            CssClass="errorMessage" />
                        <asp:Label ID="lblErrorMessage" runat="server" CssClass="errorMessage"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="150px" align="right">
                        Mã SP (<span class="commentRequireInput">*</span>):
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtSKU" MaxLength="50" Width="200px" runat="server">
                        </asp:TextBox>
                        <asp:RequiredFieldValidator ID="reqSKU" runat="server" EnableClientScript="true"
                            CssClass="errorMessage" ErrorMessage="SKU is require" Display="Dynamic" ControlToValidate="txtSKU">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Tên (<span class="commentRequireInput">*</span>):
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtProductName" MaxLength="256" Width="700px" runat="server">
                        </asp:TextBox>
                        <asp:RequiredFieldValidator ID="reqProductName" runat="server" EnableClientScript="true"
                            CssClass="errorMessage" ErrorMessage="Product Name is require" Display="Dynamic"
                            ControlToValidate="txtProductName">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Tiêu đề trang:
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtPageTitle" runat="server" MaxLength="256" Width="700px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle">
                        Meta Keywords:
                    </td>
                    <td>
                        <asp:TextBox ID="txtMetaKeywords" Width="300px" Height="80px" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </td>
                    <td align="right" valign="middle">
                        Meta Description:
                    </td>
                    <td>
                        <asp:TextBox ID="txtMetaDescription" Width="300px" Height="80px" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Danh mục:
                    </td>
                    <td colspan="3">
                         <%=html %>        
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Hiển thị:
                    </td>
                    <td width="300px" align="left">
                        <asp:CheckBox ID="chkIsActive" runat="server" Checked="true" />
                    </td>
                    <td width="80px" align="right">
                        Hot:
                    </td>
                    <td>
                        <asp:CheckBox ID="chkIsNew" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Giá mới:
                    </td>
                    <td>
                        <asp:TextBox ID="txtNowPrice" runat="server" Width="80px" onkeyup="DocTien(this);" onfocusout="DocTien(this);"></asp:TextBox>
                        <asp:CustomValidator ID="cusNowPrice" runat="server" SetFocusOnError="true" EnableClientScript="true"
                            Display="Dynamic" ErrorMessage="RequiredFieldValidator" OnServerValidate="CheckSNowPriceValid"
                            ClientValidationFunction="CheckCNowPriceValid" ControlToValidate="txtNowPrice">*</asp:CustomValidator>
                        <asp:Label ID="txtNowPriceText" runat="server"></asp:Label>
                    </td>
                    <td align="right">
                        Giá cũ:
                    </td>
                    <td>
                        <asp:TextBox ID="txtWasPrice" runat="server" Width="80px" onkeyup="DocTien(this);" onfocusout="DocTien(this);"></asp:TextBox>
                        <asp:CustomValidator ID="cusWasPrice" runat="server" SetFocusOnError="true" EnableClientScript="true"
                            Display="Dynamic" ErrorMessage="RequiredFieldValidator" OnServerValidate="CheckSWasPriceValid"
                            ClientValidationFunction="CheckCWasPriceValid" ControlToValidate="txtWasPrice">*</asp:CustomValidator>
                        <asp:Label ID="txtWasPriceText" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        Ảnh 1:
                    </td>
                    <td valign="top">
                        <table class="imgDetail">
                            <tr>
                                <td>
                                    <asp:FileUpload ID="fulProductImage1" runat="server" />
                                    <asp:CustomValidator ID="cusProductImage1" runat="server" SetFocusOnError="true"
                                        EnableClientScript="true" Display="Dynamic" ErrorMessage="RequiredFieldValidator"
                                        OnServerValidate="CheckSImageValid" ControlToValidate="fulProductImage1">*</asp:CustomValidator>
                                </td>
                            </tr>
                            <tr id="trImage1" runat="server" visible="false">
                                <td>
                                    <asp:Image ID="imgProductImage1" runat="server" ToolTip="Logo" AlternateText="Logo"
                                        Visible="true" />
                                </td>
                            </tr>
                            <tr id="trDelete1" runat="server" visible="false">
                                <td>
                                    <asp:LinkButton ID="lbtnDeleteImage1" runat="server" Visible="true" Text="Delete this image"
                                        OnClick="lbtnDeleteImage1_Click" />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td align="right" valign="top">
                        Ảnh 2:
                    </td>
                    <td valign="top">
                        <table class="imgDetail">
                            <tr>
                                <td>
                                    <asp:FileUpload ID="fulProductImage2" runat="server" />
                                    <asp:CustomValidator ID="cusProductImage2" runat="server" SetFocusOnError="true"
                                        EnableClientScript="true" Display="Dynamic" ErrorMessage="RequiredFieldValidator"
                                        OnServerValidate="CheckSImageValid" ControlToValidate="fulProductImage2">*</asp:CustomValidator>
                                </td>
                            </tr>
                            <tr id="trImage2" runat="server" visible="false">
                                <td>
                                    <asp:Image ID="imgProductImage2" runat="server" ToolTip="Logo" AlternateText="Logo"
                                        Visible="true" />
                                </td>
                            </tr>
                            <tr id="trDelete2" runat="server" visible="false">
                                <td>
                                    <asp:LinkButton ID="lbtnDeleteImage2" runat="server" Text="Delete this image" OnClick="lbtnDeleteImage2_Click"
                                        Visible="true" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        Ảnh 3:
                    </td>
                    <td valign="top">
                        <table class="imgDetail">
                            <tr>
                                <td>
                                    <asp:FileUpload ID="fulProductImage3" runat="server" />
                                    <asp:CustomValidator ID="cusProductImage3" runat="server" SetFocusOnError="true"
                                        EnableClientScript="true" Display="Dynamic" ErrorMessage="RequiredFieldValidator"
                                        OnServerValidate="CheckSImageValid" ControlToValidate="fulProductImage3">*</asp:CustomValidator>
                                </td>
                            </tr>
                            <tr id="trImage3" runat="server" visible="false">
                                <td>
                                    <asp:Image ID="imgProductImage3" runat="server" ToolTip="Logo" AlternateText="Logo" Visible="true" />
                                </td>
                            </tr>
                            <tr id="trDelete3" runat="server" visible="false">
                                <td>
                                    <asp:LinkButton ID="lbtnDeleteImage3" runat="server" Text="Delete this image" OnClick="lbtnDeleteImage3_Click"
                                        Visible="true" />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td align="right" valign="top">
                        Ảnh 4:
                    </td>
                    <td valign="top">
                        <table class="imgDetail">
                            <tr>
                                <td>
                                    <asp:FileUpload ID="fulProductImage4" runat="server" />
                                    <asp:CustomValidator ID="cusProductImage4" runat="server" SetFocusOnError="true"
                                        EnableClientScript="true" Display="Dynamic" ErrorMessage="RequiredFieldValidator"
                                        OnServerValidate="CheckSImageValid" ControlToValidate="fulProductImage4">*</asp:CustomValidator>
                                </td>
                            </tr>
                            <tr id="trImage4" runat="server" visible="false">
                                <td>
                                    <asp:Image ID="imgProductImage4" runat="server" ToolTip="Logo" AlternateText="Logo" Visible="true" />
                                </td>
                            </tr>
                            <tr id="trDelete4" runat="server" visible="false">
                                <td>
                                    <asp:LinkButton ID="lbtnDeleteImage4" runat="server" Text="Delete this image" OnClick="lbtnDeleteImage4_Click" Visible="true" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Video:
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtVideo" runat="server" MaxLength="256" Width="700px"></asp:TextBox>
                    </td>
                </tr>
                <tr id="trVideo" runat="server" visible="true">
                    <td align="right"></td>
                    <td colspan="3">
                        <asp:Literal ID="ltrVideo" runat="server"></asp:Literal>
                    </td>
                </tr>
                <tr style="display:none">
                    <td align="right">
                        Site:
                    </td>
                    <td>
                        <asp:TextBox ID="txtSite" Width="200px" runat="server"></asp:TextBox>
                    </td>
                    <td align="right">
                        Khu vực:
                    </td>
                    <td colspan="3">
                        <asp:DropDownList ID="drpZone" Width="200px" runat="server"></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Tình trạng
                    </td>
                    <td>
                        <asp:DropDownList ID="drpStatus" Width="200px" runat="server">
                            <asp:ListItem Text="Sắp về" Value="0"></asp:ListItem>
                            <asp:ListItem Text="Có hàng" Value="1" Selected="True"  ></asp:ListItem>
                            <asp:ListItem Text="Hết hàng" Value="2"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td align="right">
                        Lời nhắn 
                    </td>
                    <td colspan="3">
                        <asp:DropDownList ID="drpNote" Width="200px" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Kích cỡ:
                    </td>
                    <td>
                        <asp:DropDownList ID="drpSize" MaxLength="256" Width="150px" runat="server"></asp:DropDownList>
                        <asp:TextBox ID="txtSize" MaxLength="256" Width="120px" runat="server"></asp:TextBox>
                    </td>
                    <td align="right">
                        Màu sắc:
                    </td>
                    <td colspan="3">
                        <asp:DropDownList ID="drpColor" MaxLength="256" Width="150px" runat="server"></asp:DropDownList>
                        <asp:TextBox ID="txtColor" MaxLength="256" Width="120px" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Chất liệu:
                    </td>
                    <td>
                        <asp:DropDownList ID="drpMaterial" MaxLength="256" Width="150px" runat="server"></asp:DropDownList>
                        <asp:TextBox ID="txtMaterial" MaxLength="256" Width="120px" runat="server"></asp:TextBox>
                    </td>
                    <td align="right">
                        Xuất xứ:
                    </td>
                    <td colspan="3">
                        <asp:DropDownList ID="drpMadeIn" MaxLength="256" Width="150px" runat="server"></asp:DropDownList>
                        <asp:TextBox ID="txtMadeIn" MaxLength="256" Width="120px" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle">
                        Mô tả ngắn:
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtShortDescription" MaxLength="500" Width="700px" Height="120px"
                            runat="server" TextMode="MultiLine">
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle">
                        Mô tả:
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtDescription" MaxLength="500" Width="705px" Height="240px" runat="server"
                            TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="height: 40px;" valign="bottom" colspan="3">
                        <asp:Button ID="btnSave" runat="server" CssClass="button" Text="Save" OnClick="btnSave_Click"
                            CausesValidation="true" />
                        <asp:Button ID="btnCancel" runat="server" CssClass="button" Text="Cancel" OnClick="btnCancel_Click"
                            CausesValidation="false" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
     <input type="hidden" value="" runat="server" id="hidCategoryIDSelect" />
    <script type="text/javascript">
        DocTien(document.getElementById('ctl00_content_txtNowPrice'));
        DocTien(document.getElementById('ctl00_content_txtWasPrice'));
        var ns6 = document.getElementById && !document.all ? 1 : 0

        var head = "display:''"
        var department = ''
        function SelectCateName( id) {
            var chk = document.getElementById('chkCategory_' + id);
            if (chk) {
                var status=!chk.checked;
                chk.checked = status;
                CheckCategoryItem(id, status);
            }

        }
        function DocTien(txt) {
            var t = txt.value;
            var x = DocTienBangChu(t);
            document.getElementById(txt.id + 'Text').innerHTML = x;
        }
        var ns6 = document.getElementById && !document.all ? 1 : 0

        var head = "display:''"
        var department = ''
        function SelectCateName(id) {
            var chk = document.getElementById('chkCategory_' + id);
            if (chk) {
                var status = !chk.checked;
                chk.checked = status;
                CheckCategoryItem(id, status);
            }

        }
        function expandit(objid) {
            department = document.getElementById('SPAN' + objid).style;
            img = document.getElementById('IMG' + objid);
            fld = document.getElementById('FLD' + objid);

            if (department.display == "none") {
                department.display = "block"
                img.src = img.src.replace(/plus/i, "minus");
                fld.src = fld.src.replace(/plus/i, "minus");
            } else {
                department.display = "none"
                img.src = img.src.replace(/minus/i, "plus");
                fld.src = fld.src.replace(/minus/i, "plus");
            }
        }
        function CheckCategoryItem(id, status) {

            var idSelect = document.getElementById('<%=hidCategoryIDSelect.ClientID %>').value;
            if (status) {
                idSelect += id + ';';
            }
            else idSelect = idSelect.replace(id + ';', '');
            document.getElementById('<%=hidCategoryIDSelect.ClientID %>').value = idSelect;

        }
        function CheckCWasPriceValid(oSrc, args) {
            //check float number valid here
            args.IsValid = CheckFloatValid(args.Value);
        }
        function CheckCNowPriceValid(oSrc, args) {

            args.IsValid = CheckFloatValid(args.Value);
        }
    </script>
</asp:Content>
